package com.baseDemo.web.dao.role.impl;

import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.baseDemo.web.dao.role.RoleEntityDao;
import com.baseDemo.web.entity.RoleEntity;
import com.share.hibernate.baseDaoSupport.impl.BaseDaoHibernateSupport;
@Repository
public class RoleEntityDaoHibernate extends BaseDaoHibernateSupport<RoleEntity> implements RoleEntityDao{
	
	private static Map<String, Object> paramMap = new HashMap<String, Object>();
	
	@Override
	public Integer getPageTotal() {
		String HQL = " SELECT COUNT(id) FROM RoleEntity as RE ";
		return this.getAgg(HQL);
	}

	@Override
	public String updateRole(RoleEntity roleEntity) {
		String HQL = "update RoleEntity re set re.roleName=:roleName,re.roleDescription=:roleDescription where rs.id=:id";
		paramMap.clear();
		paramMap.put("roleName", roleEntity.getRoleName());
		paramMap.put("roleDescription", roleEntity.getRoleDescription());
		paramMap.put("id", roleEntity.getId());
		return this.execute(HQL, paramMap);
	}

}
